package com.ruoyi.product.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.product.mapper.StoreProductMapper;
import com.ruoyi.product.domain.StoreProduct;
import com.ruoyi.product.service.IStoreProductService;

/**
 * 商品Service业务层处理
 *
 * @author ruoyi
 * @date 2021-11-22
 */
@Service
public class StoreProductServiceImpl implements IStoreProductService
{
    @Autowired
    private StoreProductMapper storeProductMapper;

    /**
     * 查询商品
     *
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public StoreProduct selectStoreProductById(Long id)
    {
        return storeProductMapper.selectStoreProductById(id);
    }

    /**
     * 查询商品列表
     *
     * @param storeProduct 商品
     * @return 商品
     */
    @Override
    public List<StoreProduct> selectStoreProductList(StoreProduct storeProduct)
    {
        return storeProductMapper.selectStoreProductList(storeProduct);
    }

    @Override
    public List<StoreProduct> selectStoreProductListByY(StoreProduct storeProduct)
    {
        return storeProductMapper.selectStoreProductListByY(storeProduct);
    }

    @Override
    public List<StoreProduct> selectStoreProductListByN(StoreProduct storeProduct)
    {
        return storeProductMapper.selectStoreProductListByN(storeProduct);
    }

    @Override
    public List<StoreProduct> selectStoreProductListByIds(Long[] ids,  Long storeId)
    {
        return storeProductMapper.selectStoreProductListByIds(ids,storeId);
    }



    /**
     * 新增商品
     *
     * @param storeProduct 商品
     * @return 结果
     */
    @Override
    public int insertStoreProduct(StoreProduct storeProduct)
    {
        storeProduct.setCreateTime(DateUtils.getNowDate());
        return storeProductMapper.insertStoreProduct(storeProduct);
    }

    /**
     * 修改商品
     *
     * @param storeProduct 商品
     * @return 结果
     */
    @Override
    public int updateStoreProduct(StoreProduct storeProduct)
    {
        storeProduct.setUpdateTime(DateUtils.getNowDate());
        return storeProductMapper.updateStoreProduct(storeProduct);
    }

    /**
     * 批量删除商品
     *
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteStoreProductByIds(Long[] ids)
    {
        return storeProductMapper.deleteStoreProductByIds(ids);
    }


    /**
     * 批量逻辑删除商品
     *
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int logicDeleteStoreProduct(Long[] ids,String delType,Long delUser)
    {
        return storeProductMapper.logicDeleteStoreProduct(ids,delType,delUser);
    }

    /**
     * 删除商品信息
     *
     * @param id 商品主键
     * @return 结果
     */
    @Override
    public int deleteStoreProductById(Long id)
    {
        return storeProductMapper.deleteStoreProductById(id);
    }

    @Override
    public List<StoreProduct> selectByClassifyOrId(Long storeId, List<Long> primaryKey) {
        return storeProductMapper.selectByClassifyOrId(storeId,primaryKey);
    }

    @Override
    public List<StoreProduct> selectStoreProductByIds(List<Long> productIds) {
        return storeProductMapper.selectStoreProductByIds(productIds);
    }

    @Override
    public List<StoreProduct> selectNeedShelveDown() {
        return storeProductMapper.selectNeedShelveDown();
    }

    @Override
    public List<StoreProduct> selectStoreProductClientList(StoreProduct storeProductParam) {
        return storeProductMapper.selectStoreProductClientList(storeProductParam);
    }

    @Override
    public List<StoreProduct> selectStoreProductJointClientList(StoreProduct storeProductParam) {
        return storeProductMapper.selectStoreProductJointClientList(storeProductParam);
    }

}
